﻿using Microsoft.AspNet.SignalR;
using System;
using ZSoft.PushServices.Server.Infra.Events;
using static Utils.Utilities;

namespace ZSoft.PushServices.Server.Infra.App_Start
{
    public class SignalrConfiguration : IEventHandler
    {
        public AppEventType EventType
        {
            get
            {
                return AppEventType.Application_Start;
            }
        }

        public void Execute()
        {
            GlobalHost.Configuration.ConnectionTimeout = ConnectionTimeOut;
        }

        private static TimeSpan ConnectionTimeOut
        {
            get
            {
#if DEBUG
                return TimeSpan.FromSeconds(15);
#endif
                return TimeSpan.FromMinutes(3);

            }
        }

    }
}